#include <bits/stdc++.h>
using namespace std;
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
using ll = long long;
bool check(ll n)
{
    ll j = 1,f=0;
    while(n)
    {
        ll t = n % 10;
        if(j%2)
        {
            if(t%2)
            {
                f = 0;
            }
            else
            {
                f = 1;
                break;
            }
        }
        else{
            if(t%2==0)
            {
                f = 0;
            }
            else {
                f = 1;
                break;
            }
        }
        j++;
        n /= 10;
    }
    if(f)
    {
        return false;
    }
    return true;
}
void solve()
{
    ll ans = 0;
    ll n;
    cin >> n;
    for (ll i = 1; i <= n;i++)
    {
        if(check(i))
        {
            ans++;
        }
    }
    cout << ans << endl;
}
int main()
{
    int t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
   return 0;
}
